package com.example.luke.shengdangxiaoattendance.Model;

import android.content.Context;

import com.example.luke.shengdangxiaoattendance.Database.DingHanDB;
import com.example.luke.shengdangxiaoattendance.Util.GlobalFunction;

import java.util.ArrayList;

/**
 * Created by luke on 26/05/2017.
 */

public class Student {
    public static   final String DH_TABLE_NAME = "StudentList";

    public static   final String  student_class="student_class";//班级编号
    public static   final String  student_name="student_name";//商品编号
    public static   final String  student_employeeCode="student_employeeCode";//商品编号
    public static   final String  student_issueUnit="student_issueUnit";//单位发票名称

    public static   final String  student_gender="student_gender";//商品编号
    public static   final String  student_age="student_age";//商品编号
    public static   final String student_culture="student_culture";//单位发票名称
    public static   final String  student_id="student_id";//商品编号
    public static   final String  student_mission="student_mission";//职务
    public static   final String  student_position="student_position";//职称

    public static   final String  student_contact="student_contact";//职务
    public static   final String  student_email="student_email";//职称
    public static   final String  student_address="student_address";//职务
    public static   final String  student_roomNo="student_roomNo";//职称
    public static   final String  student_remark="student_remark";//职务

    public static   final String  student_unratedKW="student_unratedKW";//职务
    public static   final String  student_kwName="student_kwName";//职务
    public static  final String student_dateTime="student_dateTime";


    public String className;

    public String name;

    public String employeeID;

    public String issueUnit;
    public String gender;
    public String age;
    public String culture;
    public String studentID;

    public String unratedKW;
    public String dateTime;
    public String kwName;


    private  static  Course course;
    private ArrayList<Course > courseArrayList;

    public  static final String DH_CREATE_TABLE="CREATE TABLE " + DH_TABLE_NAME + "( " + student_class + " TEXT," + student_name + " TEXT,"
            + student_employeeCode + " TEXT PRIMARY KEY," + student_dateTime+" TEXT,"+ student_unratedKW+" TEXT,"+student_kwName+" TEXT," + student_id + " TEXT)";

    public static final String DH_CREATE_INDEX="CREATE INDEX  if not exists index ON"+DH_TABLE_NAME+"("+student_employeeCode+")";


    private Context context;

    public static void clearAllStudent(Context context,String date){
        DingHanDB.getInstance(context).clearAllStudent(date);

    }

    public static void saveStudent(Context context, Student course){


    if (!DingHanDB.getInstance(context).checkStudentExist(course.className,course.employeeID))
        DingHanDB.getInstance(context).insert(DH_TABLE_NAME,course);



    }

    public  static  boolean checkStudent (Context context,String className,String employeeID){
     return DingHanDB.getInstance(context).checkStudentExist(className,employeeID);

    }

}
